Fix bug with detecting fields