Fix wrong return checking