You need to set isplaceobject to 1 inside the function smile

Otherwise it will remain 0, and the code in the loop will never be reached anymore, as the while-condition will then be false.