Corrected some potential issues in the questlog system

- Should fixe bugreport:7888, thanks to rosfus
  http://hercules.ws/board/tracker/issue-7888-some-issue-crush-my-mapserver
- Special thanks to Ind.

Signed-off-by: Haru <haru@dotalux.com>