fix image ext checking bug