Fixes division by 0 warning and page type notice