Maybe you have something in your code that override the initial settings.
You can try the video_switch (var res,var depth,var window) function and call it at different places in your code structure and see if the problem persists:
video_switch(8,32,1); //1024x768 in fullscreen mode.
Hope it helps.