Improved security and fixed error page bug