remove unnecessary condition and cast