Properly check for allowed extensions