Use basename instead of substr strrpos

Use basename instead of strrpos