fixed some bugs, added error and required marker