fixed small potential programming errors