Fixed viewport error caused by rounding

viewport_width was being calculated as 399.99999... and then truncated. Now it's correctly rounded and should take care of the nasty resizing referred to here #229