Fixed error check for ropt