moved validation after attachment