Added more checks to detect invalid task submission