slapos_web: Fix script to handle avoid security problems

Fix script to handle avoid security problems when invoke methods too early.