Fixed submission query. Closes #317.