feature #82 : Fixing Javascript infinite loop