Optimize collision code & Show warning message when unexpected error occurs